package com.xyrl.third.aliyun.configuration;

import com.xyrl.third.aliyun.config.AliYunProperties;
import com.xyrl.third.aliyun.service.MsgService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnClass(MsgService.class)
@EnableConfigurationProperties(AliYunProperties.class)
public class MsgAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean(MsgService.class)
    public MsgService aliyunMsgService() {
        MsgService msgService = new MsgService();
        // 如果提供了其他set方法，在此也可以调用对应方法对其进行相应的设置或初始化。
        return msgService;
    }
}
